package com.xiaoshuidi.cloud.module.rooms.api.map;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.framework.common.pojo.PageResult;
import com.xiaoshuidi.cloud.module.rooms.api.map.vo.GetMapRespApiVO;
import com.xiaoshuidi.cloud.module.rooms.api.map.vo.MapFindSearchReqApiVO;
import com.xiaoshuidi.cloud.module.rooms.api.map.vo.MetroRouteRespApiVO;
import com.xiaoshuidi.cloud.module.rooms.api.map.vo.MetroSiteRespApiVO;
import com.xiaoshuidi.cloud.module.rooms.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = ApiConstants.SERVERNAME)
public interface MapApi {

    String PREFIX = ApiConstants.PREFIX + "/map";

    @Operation(summary = "地图找房")
    @Parameters({
            @Parameter(name = "maxLongitude", description = "最大经度", required = true),
            @Parameter(name = "minLongitude", description = "最小经度", required = true),
            @Parameter(name = "maxLatitude", description = "最大纬度", required = true),
            @Parameter(name = "minLatitude", description = "最小纬度", required = true),
            @Parameter(name = "isConcentrated", description = "是否集中式", required = true),
            @Parameter(name = "district", description = "区域"),
            @Parameter(name = "monthRentalMin", description = "租金范围-下限"),
            @Parameter(name = "monthRentalMax", description = "租金范围-上限"),
            @Parameter(name = "longitude", description = "地铁站经度"),
            @Parameter(name = "latitude", description = "地铁站纬度"),
            @Parameter(name = "isWhole", description = "出租方式,是否整租 true:整租 false:合租"),
            @Parameter(name = "bedRoomNum", description = "户型-几室 1:一室 2:二室 3:三室 4:四室 5:其他"),
            @Parameter(name = "publicFacilities", description = "特色需求(公共设施)"),
            @Parameter(name = "roomHouseState", description = "房源状态 1：可租房源 2：全部房源", required = true),
            @Parameter(name = "zoom", description = "缩放等级", required = true),
    })
    @GetMapping(PREFIX + "/mapfindroom")
    public CommonResult<List<GetMapRespApiVO>> mapFindRoom(@RequestParam("maxLongitude") Double maxLongitude,
                                                           @RequestParam("minLongitude") Double minLongitude,
                                                           @RequestParam("maxLatitude") Double maxLatitude,
                                                           @RequestParam("minLatitude") Double minLatitude,
                                                           @RequestParam("tenantId") Long tenantId,
                                                           @RequestParam("isConcentrated") Boolean isConcentrated,
                                                           @RequestParam(value = "district",required = false) String district,
                                                           @RequestParam(value = "monthRentalMin",required = false) Double monthRentalMin,
                                                           @RequestParam(value = "monthRentalMax",required = false) Double monthRentalMax,
                                                           @RequestParam(value = "longitude",required = false) Double longitude,
                                                           @RequestParam(value = "latitude",required = false) Double latitude,
                                                           @RequestParam(value = "isWhole",required = false) Boolean isWhole,
                                                           @RequestParam(value = "bedRoomNum",required = false) Integer bedRoomNum,
                                                           @RequestParam(value = "publicFacilities",required = false) String publicFacilities,
                                                           @RequestParam("roomHouseState") String roomHouseState,
                                                           @RequestParam("zoom") Double zoom);

    @Operation(summary = "地图找房-搜索")
    @Parameters({
            @Parameter(name = "searchBox", description = "搜索框内容"),
    })
    @PostMapping(PREFIX + "/map-find-search")
    public CommonResult<PageResult<GetMapRespApiVO>> mapFindSearch(@RequestBody MapFindSearchReqApiVO reqVO);

    @Operation(summary = "获取所有地铁线路")
    @GetMapping(PREFIX + "/metro-route")
    public CommonResult<List<MetroRouteRespApiVO>> getMetroRoute();

    @Operation(summary = "获取地铁线路下的站点")
    @GetMapping(PREFIX + "/metro-site")
    public CommonResult<List<MetroSiteRespApiVO>> getMetroSite(@RequestParam("id") Long id);
}
